<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class CourseClass extends Model
{
    use SoftDeletes;

    protected $table = 'course_class';

    public function courseType(){
        return $this->belongsTo('App\Models\Ctype','course_type_id','id');
    }

    public function getCourseCount(){
        return Course::where('course_class_id',$this->id)->count();
    }
    
    public function users(){
    	return $this->belongsTo("App\User", "opertion_user_id", "id");	
    }

    public function author(){
        return $this->belongsTo("App\User", "user_id", "id");
    }

    public function courseSection(){
        return $this->hasMany('App\Models\CourseSection','course_class_id','id');
    }

}
